from concurrent.futures import ProcessPoolExecutor
import time


def task(sleep_sec=10, tag='test'):
    print('[%s] start sleep' % tag)
    time.sleep(sleep_sec)
    print('[%s] finish sleep' % tag)
    return 100


class MyJob:
    def __init__(self) -> None:
        pass

    def run(self, field_list, time_list, dateadd):
        pros = []
        cnt = 0
        for field in field_list:
            for tim in time_list:
                process = ReserveProcess()
                process.arg(field, tim, dateadd)
                process.start()
                pros.append(process)
                process.join()
        #[x.start() for x in pros]
        #[x.join() for x in pros]


def main():
    process_pool = ProcessPoolExecutor(max_workers=3)
    future = process_pool.submit(task, 3, tag='TEST')
    ret = future.result()
    print('result is %s' % str(ret))
    process_pool.shutdown()


if __name__ == '__main__':
    main()
